package net.dopan.pigframe.core.utils;

import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @Package: net.dopan.pigframe.core.utils
 * @Title: PasswodUtils
 * @Description: 密码加密
 * @author: 刘宽
 * @date: 2018-09-10 15:49
 */
public class PasswodUtils {

    private static PasswordEncoder passwordEncoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();

    public static String encode(String rawPassword) {
        return passwordEncoder.encode(rawPassword);
    }

    public static Boolean matches(String rawPassword, String encodedPassword) {
        return passwordEncoder.matches(rawPassword, encodedPassword);
    }
}